package cn.bkw.ytkapi.utils;
import org.apache.log4j.PropertyConfigurator;
import javax.servlet.http.HttpServlet; 
import javax.servlet.http.HttpServletRequest; 
import javax.servlet.http.HttpServletResponse; 
 
 /** 
  * 日志类 
  * 
  */  
 
@SuppressWarnings("serial")
public class log4jInit extends HttpServlet {  
       public void init() { 
            String prefix =getServletContext().getRealPath("/"); 
            String file = getInitParameter("log4j");//配置文件位置 
            if(file != null) {   
                PropertyConfigurator.configure(prefix+file);  
            }  
       } 

      public void doGet(HttpServletRequest req, HttpServletResponse res)
     {    } 
} 